<?php

class Pictures_Image_EditInputView extends BlogPicturesBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd, 'blog');
		$ro = $this->getContext()->getRouting();
		$params = $rd->getParameters();
		$pic_id = $params['pic_id'];
		/* @var $model Pictures_PicturesModel */
		$model = $this->getContext()->getModel('Pictures', 'Pictures');
		
		$picture = $model->getPicture($pic_id, null);
		$picture_name = $picture->name;
		
		$this->setAttribute('submit_route', $ro->gen('pic.edit', array('pic_id'=>$pic_id)));
		$this->setAttribute('current_image_name', $picture_name);
		$this->setAttribute('preview_url', $ro->gen('pic.display', array('pic_name'=>$picture_name)));
		$this->setAttribute('title', 'Edit picture');
		
		$form_params = array(
		    'image_name' => $picture_name,
		    );
		$this->getContext()->getRequest()->setAttribute('populate',
            new AgaviParameterHolder($form_params),
            'org.agavi.filter.FormPopulationFilter');
	}
}

?>
